
namespace Patterns4Net.Core.Patterns
{
    using Mono.Cecil;
    using Attributes.DesignPatterns;

    /// <summary>
    /// Represents the Proxy design pattern.
    /// </summary>
    [Immutable]
    public class Proxy : PatternBase, IWrapper
    {
        public Proxy(TypeDefinition proxyType, TypeReference subject, TypeReference realSubject)
        {
            this.ProxyType = proxyType;
            this.Subject = subject;
            this.RealSubject = realSubject;
        }

        public TypeDefinition ProxyType { get; private set; }

        public TypeReference Subject { get; private set; }

        public TypeReference RealSubject { get; private set; }

        #region IWrapper Members

        TypeReference IWrapper.WrappedType
        {
            get { return this.RealSubject; }
        }

        TypeReference IWrapper.TargetInterface
        {
            get { return this.Subject; }
        }

        TypeDefinition IWrapper.WrapperType
        {
            get { return this.ProxyType; }
        }

        #endregion
    }
}
